package com.llsydn.demo.sqliteBl;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * @author lilinshen
 * @title sqlite数据库操作工具类
 * @description 请填写相关描述
 * @date 2018/9/26 11:48
 */
public class DBHelper extends SQLiteOpenHelper {
    public DBHelper(Context context) {
        super(context, "llsydn.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.e("TAG", "DBHelper onCreate()");
        //创建表
        String sql1 = "create table black_number(_id integer primary key autoincrement, number varchar)";
        db.execSQL(sql1);
        //插入数据
        String sql2 = "insert into black_number(number) values('13543844606')";
        db.execSQL(sql2);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.e("TAG", "DBHelper onUpgrade()");
    }
}
